<!doctype HTML public "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- Click to Convert 5.2: Anything to HTML -->
<!-- http://www.clicktoconvert.com -->

<html>
<head>
<title>gravityboxscheduleuserguide - page 62 of 234</title>
<meta http-equiv=content-type content=text/html;charset=iso-8859-1>
<meta name="Generator" content="Click to Convert">

<!--Start of page styles-->
<STYLE TYPE="text/css">
<!--
 /* Foreground Image Styles */

 /* Position Styles */
 .ts62p0{position:absolute;left:106px;top:97px;}
 .ts62p1{position:absolute;left:352px;top:97px;}
 .ts62p3{position:absolute;left:672px;top:97px;}
 .ts62p7{position:absolute;left:106px;top:113px;}
 .ts62p8{position:absolute;left:706px;top:1026px;}
 .ts62p9{position:absolute;left:331px;top:1044px;}
 .ts62p13{position:absolute;left:106px;top:147px;}
 .ts62p15{position:absolute;left:106px;top:165px;}
 .ts62p16{position:absolute;left:106px;top:183px;}
 .ts62p18{position:absolute;left:106px;top:201px;}
 .ts62p21{position:absolute;left:106px;top:220px;}
 .ts62p23{position:absolute;left:106px;top:238px;}
 .ts62p25{position:absolute;left:106px;top:256px;}
 .ts62p27{position:absolute;left:106px;top:274px;}
 .ts62p29{position:absolute;left:106px;top:292px;}
 .ts62p31{position:absolute;left:106px;top:310px;}
 .ts62p33{position:absolute;left:106px;top:328px;}
 .ts62p35{position:absolute;left:106px;top:346px;}
 .ts62p37{position:absolute;left:106px;top:365px;}
 .ts62p40{position:absolute;left:106px;top:383px;}
 .ts62p42{position:absolute;left:106px;top:401px;}
 .ts62p44{position:absolute;left:106px;top:419px;}
 .ts62p46{position:absolute;left:106px;top:437px;}
 .ts62p48{position:absolute;left:106px;top:455px;}
 .ts62p50{position:absolute;left:106px;top:473px;}
 .ts62p52{position:absolute;left:106px;top:491px;}
 .ts62p55{position:absolute;left:106px;top:510px;}
 .ts62p57{position:absolute;left:106px;top:528px;}
 .ts62p59{position:absolute;left:106px;top:546px;}
 .ts62p61{position:absolute;left:106px;top:564px;}
 .ts62p63{position:absolute;left:106px;top:582px;}
 .ts62p65{position:absolute;left:106px;top:600px;}
 .ts62p68{position:absolute;left:106px;top:618px;}
 .ts62p70{position:absolute;left:106px;top:636px;}
 .ts62p72{position:absolute;left:106px;top:655px;}
 .ts62p74{position:absolute;left:106px;top:673px;}
 .ts62p76{position:absolute;left:106px;top:691px;}
 .ts62p78{position:absolute;left:106px;top:709px;}
 .ts62p80{position:absolute;left:106px;top:727px;}
 .ts62p82{position:absolute;left:106px;top:745px;}
 .ts62p83{position:absolute;left:106px;top:764px;}
 .ts62p84{position:absolute;left:154px;top:764px;}
 .ts62p85{position:absolute;left:106px;top:782px;}
 .ts62p86{position:absolute;left:106px;top:801px;}
 .ts62p88{position:absolute;left:106px;top:819px;}
 .ts62p89{position:absolute;left:106px;top:837px;}
 .ts62p90{position:absolute;left:106px;top:856px;}
 .ts62p92{position:absolute;left:106px;top:874px;}
 .ts62p93{position:absolute;left:106px;top:893px;}
 .ts62p94{position:absolute;left:106px;top:911px;}
 .ts62p96{position:absolute;left:106px;top:929px;}
 .ts62p97{position:absolute;left:106px;top:948px;}
 .ts62p99{position:absolute;left:106px;top:966px;}

 /* Font Styles */
 .ft0p62{font-style:normal;font-weight:bold;font-size:13px;font-family:arial,sans-serif;color:#000000;}
 .ft1p62{font-weight:normal;}
 .ft2p62{font-style:normal;font-weight:normal;font-size:13px;font-family:"times new roman","times new roman",times,serif;color:#000000;}
 .ft3p62{font-style:normal;font-weight:normal;font-size:16px;font-family:"times new roman","times new roman",times,serif;color:#000000;}
 .ft4p62{font-style:normal;font-weight:bold;font-size:11px;font-family:arial,sans-serif;color:#000000;}
 .ft5p62{font-style:normal;font-weight:normal;font-size:16px;font-family:"courier new",courier,monospace;color:#000000;}
 .ft6p62{font-family:arial,sans-serif;}
 .ft7p62{font-style:normal;font-weight:normal;font-size:16px;font-family:arial,sans-serif;color:#000000;}

 /* Background Style */
 .styleBackground62{position:absolute;left:97px;top:145px}

 /* Navigation Styles */
 .styleNavBarTop{position:absolute;left:0px;top:2px}
 .nb{position:absolute;left:2px;top:0px}
 .nbs{position:absolute;left:0px;top:0px}
 .nbe{position:absolute;left:836px;top:0px}
 .styleNavBarBot{position:absolute;left:0px;top:1117px}
-->
</STYLE>
<!--End of page styles-->

</head>
<body bgcolor="#ffffff" text="#000000" link="#0000FF" Vlink="#660099">

<table id="pageTable" width="836" STYLE="position: relative; left: auto; top: auto;"><tr><td>
<div class=nbs><img src="./navbarstart.gif" width="2" height="30"></div>
<div class=nb><img src="./navbar.gif" width="836" height="30" alt="Navigation bar"></div>
<div class=nbe><img src="./navbarend.gif" width="2" height="30"></div>
<div class=styleNavBarTop>
<table width="834" height="26" border="0" cellspacing="0">
  <tr align="left">
    <td width="4">&nbsp;</td>
    <td width="25" align="center"><a href="http://www.gravitybox.com" target="_parent"><img src="./home.gif" border="0" alt="Home"></a></td>
    <td width="25" align="center"><a href="#" onClick="window.open('./print.html','Printing','width=300,height=100,toolbar=no,directories=no');return false;"><img src="./print.gif" border="0" alt="Print document"></a></td>
    <td width="10" align="center"><img src="./separator.gif" border="0"></td>
    <td width="18" align="center"><a href="./index1.html"><img src="./start.gif" width="18" height="14" border="0" alt="Start"></a></td>
    <td width="18" align="center"><a href="./index61.html"><img src="./back.gif" width="14" height="14" border="0" alt="Previous page"></a></td>
    <td width="80" valign="middle"><table width="100%" height="16" border="0" cellspacing="1" bgcolor="#ACA899"><tr><td align="center" bgcolor="#ffffff"><font face=verdana,arial,sans-serif><font size="1">&nbsp;62 of 234&nbsp;</font></font></td></tr></table></td>
    <td width="18" align="center"><a href="./index63.html"><img src="./forward.gif" width="14" height="14" border="0" alt="Next page"></a></td>
    <td width="18" align="center"><a href="./index234.html"><img src="./end.gif" width="18" height="14" border="0" alt="End"></a></td>
    <td width="620">&nbsp;</td>
  </tr>
</table>
<p>
</div>
<nobr>
<div class=styleBackground62><img src="./background62.png" width="633" height="910" border="0" alt=""></div>
<div class=ts62p0><span class="ft0p62"> </span></div>
<div class=ts62p1><span class="ft0p62">Gravitybox Schedule Primer<span class="ft1p62"> </span></span></div>
<div class=ts62p3><span class="ft0p62">Page 60&nbsp; </span></div>
<div class=ts62p7><span class="ft2p62"> </span></div>
<div class=ts62p8><span class="ft3p62"> </span></div>
<div class=ts62p9><span class="ft4p62">1998&#45;2004 Gravitybox Software LLC<span class="ft3p62"> </span></span></div>
<div class=ts62p13><span class="ft5p62">Dim oAppt As CScheduleEl </span></div>
<div class=ts62p15><span class="ft5p62"> </span></div>
<div class=ts62p16><span class="ft5p62">&nbsp; Set Db = New ADODB.Connection </span></div>
<div class=ts62p18><span class="ft5p62">&nbsp; Db.ConnectionString = GetConnectString &#38; AppPath &#38; _ </span></div>
<div class=ts62p21><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;schedule.mdb&#34; </span></div>
<div class=ts62p23><span class="ft5p62">&nbsp; Call Db.Open </span></div>
<div class=ts62p25><span class="ft5p62">&nbsp;&nbsp; </span></div>
<div class=ts62p27><span class="ft5p62">&nbsp; sSql = &#34;delete from tbl_Schedule where StartDate &#147; &#38; _ </span></div>
<div class=ts62p29><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#147; = #1/1/2002#&#34; </span></div>
<div class=ts62p31><span class="ft5p62">&nbsp; Call Db.Execute(sSql) </span></div>
<div class=ts62p33><span class="ft5p62">&nbsp; For Each oAppt In Schedule1.ScheduleItems </span></div>
<div class=ts62p35><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div class=ts62p37><span class="ft5p62">&nbsp;&nbsp;&nbsp; If Schedule1.Categories.Exists(oAppt.Category) Then </span></div>
<div class=ts62p40><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lCategoryId = Schedule1.Categories(oAppt.Category).Id </span></div>
<div class=ts62p42><span class="ft5p62">&nbsp;&nbsp;&nbsp; Else </span></div>
<div class=ts62p44><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lCategoryId = 0 </span></div>
<div class=ts62p46><span class="ft5p62">&nbsp;&nbsp;&nbsp; End If </span></div>
<div class=ts62p48><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div class=ts62p50><span class="ft5p62">&nbsp;&nbsp;&nbsp; sSql = &#34;insert into tbl_Schedule (StartDate, &#34; &#38; _ </span></div>
<div class=ts62p52><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;StartTime , Length, Description, RoomId, &#34; &#38; _ </span></div>
<div class=ts62p55><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;CategoryId) values (&#34; &#38; _ </span></div>
<div class=ts62p57><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;#1/1/2002#,&#34; &#38; _ </span></div>
<div class=ts62p59><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;#&#34; &#38; oAppt.StartTime &#38; &#34;#,&#34; &#38; _ </span></div>
<div class=ts62p61><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oAppt.Length &#38; &#34;,&#34; &#38; _ </span></div>
<div class=ts62p63><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;'&#34; &#38; oAppt.DisplayText &#38; &#34;',&#34; &#38; _ </span></div>
<div class=ts62p65><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Schedule1.Rooms(oAppt.Room).Id &#38; &#34;,&#34; &#38; _ </span></div>
<div class=ts62p68><span class="ft5p62">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lCategoryId &#38; &#34;)&#34; </span></div>
<div class=ts62p70><span class="ft5p62">&nbsp;&nbsp;&nbsp; Call Db.Execute(sSql) </span></div>
<div class=ts62p72><span class="ft5p62">&nbsp; Next </span></div>
<div class=ts62p74><span class="ft5p62">&nbsp;&nbsp; </span></div>
<div class=ts62p76><span class="ft5p62"> Changed = False </span></div>
<div class=ts62p78><span class="ft5p62">&nbsp; </span></div>
<div class=ts62p80><span class="ft5p62">End Sub<span class="ft6p62"> </span></span></div>
<div class=ts62p82><span class="ft7p62"> </span></div>
<div class=ts62p83><span class="ft7p62"> </span></div>
<div class=ts62p84><span class="ft7p62">This example illustrates the reason we remove all appointments and resave </span></div>
<div class=ts62p85><span class="ft7p62">them. There are other schemes of course, some of which may be quite complicated. </span></div>
<div class=ts62p86><span class="ft7p62">You could, for example, store the appointment&#146;s database key in the ScheduleItem&#146;s Id </span></div>
<div class=ts62p88><span class="ft7p62">property. Then on save the source date&#146;s schedule, you could update the appointment </span></div>
<div class=ts62p89><span class="ft7p62">by adding this &#147;Id&#148; to a SQL where clause, to uniquely identify the appointment. </span></div>
<div class=ts62p90><span class="ft7p62">However you must also loop and create a delete query to remove all appointments that </span></div>
<div class=ts62p92><span class="ft7p62">are not now in the set of appointments for a particular date. Does that sound </span></div>
<div class=ts62p93><span class="ft7p62">complicated? It is a bit and depending on the database and number of appointments </span></div>
<div class=ts62p94><span class="ft7p62">could be quite time consuming as well. I have chosen the quick and dirty approach. You </span></div>
<div class=ts62p96><span class="ft7p62">may feel free to construct arbitrarily, complex algorithms that accomplish the same thing </span></div>
<div class=ts62p97><span class="ft7p62">as I have done here with minimal code. </span></div>
<div class=ts62p99><span class="ft7p62"> </span></div>
<div class=styleNavBarBot>
<table width="836" border="0" cellspacing="2">
  <tr></tr>
  <tr>
    <td width="118"><a href="http://www.purepage.com"><img src="./smalllogo.gif" width="118" height="46" border="0" alt="http://www.purepage.com"></a></td>
    <td></td>
  </tr>
</table>
</div>

</td></tr></table>

</body>
</html>
